﻿
// 添加内容
function submit_edit_content() {
    if ($("#slID").val() == "") {
        var s = "";
        s = $.ajax({
            type: "POST",
            url: "AjaxAction.ashx",
            data: {
                dowhat: "add_slider",
                ColumnID: $("#ColumnID").val(),
                Title: $("#Title").val(),
                PictureAddress: $("#PictureAddress").val(),
                ArticleAddress: $("#ArticleAddress").val(),
                Remark: $("#Remark").val(),
            },
            async: false
        }).responseText;
        if (s == "success") {
            $("#Title").val(""); $("#PictureAddress").val(""); $("#ArticleAddress").val(""); $("#Remark").val("");
            $(".red").hide();
            $(".green").show();
            setTimeout(function () { $(".green").fadeOut() }, 3000);
        }
        else {
            $(".green").hide();
            $(".red").show();
            setTimeout(function () { $(".red").fadeOut() }, 3000);
        }
    }
    else {
        var s = "";
        s = $.ajax({
            type: "POST",
            url: "AjaxAction.ashx",
            data: {
                dowhat: "update_slider",
                ColumnID: $("#ColumnID").val(),
                Title: $("#Title").val(),
                PictureAddress: $("#PictureAddress").val(),
                ArticleAddress: $("#ArticleAddress").val(),
                Remark: $("#Remark").val(),
                ID: $("#slID").val()
            },
            async: false
        }).responseText;
        if (s == "success") {
            $(".red").hide();
            $(".green").show();
            setTimeout(function () { $(".green").fadeOut() }, 3000);
        }
        else {
            $(".green").hide();
            $(".red").show();
            setTimeout(function () { $(".red").fadeOut() }, 3000);
        }

    }
}
    // 删除内容
    function submit_delete_slider(ID) {
        $("#dialog-confirm").removeClass('hide').dialog({
            resizable: false,
            modal: true,
            title: "<div class='widget-header'><h4 class='smaller'><i class='icon-warning-sign red'></i>删除图片</h4></div>",
            title_html: true,
            buttons: [
                {
                    html: "<i class='icon-trash'></i>&nbsp; 删除",
                    "class": "btn btn-danger btn-xs",
                    click: function () {
                        var s = "";
                        s = $.ajax({
                            type: "POST",
                            url: "AjaxAction.ashx",
                            data: {
                                dowhat: "delete_slider",
                                ColumnID: $("#ColumnID").val(),
                                ID: ID
                            },
                            async: false
                        }).responseText;
                        if (s == "success") {
                            window.location.href = "Default.aspx" + location.search;
                        }
                    }
                }
                ,
                {
                    html: "<i class='icon-remove'></i>&nbsp; 取消",
                    "class": "btn btn-xs",
                    click: function () {
                        $(this).dialog("close");
                    }
                }
            ]
        });
    };
function clearContent() {
    $("#slID").val(""); $("#Title").val(""); $("#PictureAddress").val(""); $("#ArticleAddress").val(""); $("#Remark").val("");

}
// 更新内容
function fixedContent(id, title, purl, aurl, remark) {
    $("#slID").val(id); $("#Title").val(title); $("#PictureAddress").val(purl); $("#ArticleAddress").val(aurl); $("#Remark").val(remark);

};